package service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import entity.LayRequest;
import entity.Permission;
import entity.Role;
import mapper.PermissionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Administrator
 * @create 2020.06.19 下午 2:43
 */
@Service
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    private PermissionMapper permissionMapper;
    @Override
    public PageInfo<Permission> selectByMap(LayRequest layRequest) {
        PageHelper.startPage(layRequest.getPage(),layRequest.getLimit());
        List<Permission> roles=permissionMapper.selectByMap(layRequest.getParams());
        return new PageInfo<>(roles);
    }

    @Override
    public List<Permission> selectAll() {
        return permissionMapper.selectAll();
    }

    @Override
    public boolean insert(Permission permission) {
        return permissionMapper.insert(permission)>0?true : false;
    }
}
